/**
 * @Title:PermissionService.java
 * @Package:com.xpjhs.permission.service
 * @Description:TODO
 * @author:luckyboyguo@126.com
 * @date:2015年1月16日{time}
 * @version:v1.0
 */
package com.xpjhs.permission.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.xpjhs.permission.dao.PermissionDao;
import com.xpjhs.permission.model.Permission;

/**
 * @ClassName:PermissionService
 * @Description:{todo
 * @author luckyboyguo@126.com
 * @date:2015年1月16日上午11:38:43
 */
@Service
@Transactional(readOnly = true)
@SuppressWarnings("unused")
public class PermissionService {

	@Autowired
	private PermissionDao permissionDao;

	public void savePermission(Permission permission) {
		permissionDao.save(permission);
	}

	public void deletePermission(long id) {
		permissionDao.delete(id);
	}

	public List<Permission> listAllPermissions() {
		return permissionDao.findAll();
	}

	public Permission getPermissionById(long id) {
		return permissionDao.findOne(id);
	}

	public Page<Permission> listByPage(Pageable pageable) {
		return permissionDao.findAll(pageable);
	}
}
